//============================================================================
// Name        : bubble-sort.cpp
// Author      : Elliott Fawcett
// Date        : 9/30/2011
// Copyright   : Credit goes to Algolist.net and the TA's
// Description : Implementation of bubble sort in C++
//============================================================================

#include "sort.h"

void 
BubbleSort::sort(int A[], int size)			// main entry point
{
    bool swapped = true;
    int tmp;
    while (swapped) 
	{
        swapped = false;
        for (int i = 0; i < size - 1; i++) 
		{
			num_cmps++;
            if (A[i] > A[i + 1]) 
			{
                tmp = A[i];
                A[i] = A[i + 1];
                A[i + 1] = tmp;
                swapped = true;
            }
        }
    }
}
